package com.tokenplus.thai.utils.update;

import android.os.Handler;
import android.os.Looper;
import android.os.Message;

import androidx.annotation.NonNull;

public class ZHIVersionMsgHandler extends Handler {

    public static final int UPDATE = 0x01;
    private ZHIVersionProgressListener mZHIVersionProgressListener;

    public ZHIVersionMsgHandler(ZHIVersionProgressListener listener) {
        super(Looper.getMainLooper());
        this.mZHIVersionProgressListener = listener;
    }

    @Override
    public void handleMessage(@NonNull Message msg) {
        switch (msg.what) {
            case UPDATE:
                ZHIVersionProgress stupidVersionProgress = (ZHIVersionProgress) msg.obj;
                //接口返回
                if (mZHIVersionProgressListener != null) {
                    mZHIVersionProgressListener.onProgress(stupidVersionProgress.getCurrentBytes(), stupidVersionProgress.getContentLength(), stupidVersionProgress.isDone());
                }
                break;

        }
    }
}
